/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 * 输入年份
 * 判断是否被400整除
 * 判断是否被4整除
 * 判断是否被100整除
 */

package leap_year;
import java.io.*;
/**
 *
 * @author hhl
 */
public class Leap_year {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int mode;
        boolean dispose = true;
        String s = "";
        while(dispose){
            System.out.println("请选择工作工作模式：（1=判断是否是闰年/其它=退出）");
            try{
                BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                s = in.readLine();
            }
            catch(IOException e){}
            mode = Integer.parseInt(s);
            switch(mode){
                case 1:
                    // catch input
                    System.out.println("请输入要查询的年份：");
                    int year;
                    try{
                        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                        s = in.readLine();
                    }
                    catch(IOException e){}
                    year = Integer.parseInt(s);
                    // judge
                    System.out.println("年份"+year+"是不是闰年的判断结果为："+Judge(year));
                    break;
                default:
                    //exit
                    dispose = false;
                    System.out.println("期待下次光临！");
                    break;

            }

        }

    }

    static boolean Judge(int year){
        if(year%400==0)
            return true;
        if(year%4==0&&year%100!=0)
            return true;
        return false;
    }
}
